import numpy as np
weight = 0.02
pre = None

def smooth(data):
    data = np.asarray(data)
    global pre
    if pre is None:
        pre = data
        return pre
    data = pre*(1-weight) + data*weight
    pre = data
    return data